<template>
  <div
    class="originProject preview-form"
    style=" background:rgba(255, 255, 255, 0);"
  >
    <Row :gutter="20">
      <Col :span="12">
        <div class="comCard">
          <Card dis-hover>
            <div
              class="comLabel"
              style=" padding:15px; border-bottom-width:1px; border-bottom-style:solid; border-bottom-color:#E6E6E6; font-size:16px; font-weight:bold;"
            >
              <p>
                &nbsp;部门列表
              </p>

              <div class="btnGroup">
                <div>
                  <Button
                    icon="md-refresh"
                    @click="
                      refreshSearch({
                        formId: '',
                        ajaxUrl:
                          'http://design.xundacloud.com/autoCoding/project/addPageData',
                        tableId: 'a416577d7cd6e',
                        reformId: '',
                        pageRecordId: '',
                      })
                    "
                  >
                    刷新
                  </Button>
                </div>
              </div>
            </div>
            <div class="comQuery " style=" padding:15px;">
              <Form inline>
                <Form-item>
                  <Select
                    v-model="searchSearchKey"
                    not-found-text="暂无数据"
                    :disabled="searchMore"
                    transfer
                    transfer-class-name="customTransfer"
                    class=""
                    style=" width:140px;"
                  >
                    <Option
                      v-for="(item, index) in searchQuery"
                      :value="item.value"
                      :key="index"
                      @click.native="searchQuerySelect(item)"
                    >
                      {{ item.label }}
                    </Option>
                  </Select>
                </Form-item>
                <Form-item>
                  <div v-for="(colum, cindex) in searchQuery" :key="cindex">
                    <div
                      v-if="searchType === colum.type && searchType === 'text'"
                    >
                      <Input
                        v-bind="colum.props"
                        v-model="colum.mValue"
                        v-if="colum.value === searchSearchKey"
                        :disabled="searchSearchMore"
                        class=""
                        style=" width:200px;"
                      ></Input>
                    </div>
                    <div
                      v-if="
                        searchType === colum.type && searchType === 'select'
                      "
                    >
                      <Select
                        v-if="colum.value === searchSearchKey"
                        v-bind="colum.props"
                        :disabled="searchSearchMore"
                        transfer
                        class="customSelect "
                        v-model="colum.mValue"
                        style=" width:200px;"
                      >
                        <Option
                          v-for="(item, iIndex) in colum.optionList"
                          :key="iIndex"
                          :value="item.value"
                        >
                          {{ item.label }}
                        </Option>
                      </Select>
                    </div>
                    <div
                      v-if="searchType === colum.type && searchType === 'date'"
                    >
                      <DatePicker
                        v-bind="colum.props"
                        v-if="colum.value === searchSearchKey"
                        :disabled="searchSearchMore"
                        class=""
                        v-model="colum.mValue"
                        transfer
                        style=" width:200px;"
                      ></DatePicker>
                    </div>
                  </div>
                </Form-item>
                <Form-item>
                  <Button
                    name="查询"
                    icon="md-search"
                    type="primary"
                    @click="searchQuerySearch()"
                  >
                    查询
                  </Button>
                  <Button name="组合查询" @click="searchsearchMore()">
                    组合查询&nbsp;
                    <Icon type="ios-arrow-down" v-show="!searchSearchMore" />
                    <Icon type="ios-arrow-up" v-show="searchSearchMore" />
                  </Button>
                </Form-item>
                <div class="searchMoreBox" v-if="searchSearchMore">
                  <Form-item v-for="(item, index) in searchQuery" :key="index">
                    <div v-if="item.type === 'text'">
                      <div class="inline">
                        <span class="label ">{{ item.label }}</span>
                        <Input
                          v-bind="item.props"
                          class=""
                          v-model="item.mValue"
                        ></Input>
                      </div>
                    </div>
                    <div v-if="item.type === 'select'">
                      <div class="inline">
                        <span class="label ">{{ item.label }}</span>
                        <Select
                          v-bind="item.props"
                          transfer
                          class="customSelect  "
                          v-model="item.mValue"
                        >
                          <Option
                            v-for="(citem, iIndex) in item.optionList"
                            :key="iIndex"
                            :value="citem.value"
                          >
                            {{ citem.label }}
                          </Option>
                        </Select>
                      </div>
                    </div>
                    <div v-if="item.type === 'date'">
                      <div class="inline">
                        <span class="label ">{{ item.label }}</span>
                        <DatePicker v-model="item.mValue" class=""></DatePicker>
                      </div>
                    </div>
                  </Form-item>
                </div>
              </Form>
            </div>
            <div
              class="comTabel"
              style=" margin-left:15px; margin-right:15px; margin-top:0px;"
            >
              <Table
                :columns="deptTable"
                :data="deptTableData"
                :height="300"
                :show-header="true"
                :border="true"
                :highlight-row="true"
                @on-row-click="deptRowClick"
              >
                <template slot-scope="{ row, column }" slot="auto">
                  <component
                    :is="column.type"
                    :data="row[column.key]"
                  ></component>
                </template>
                <template slot-scope="{ row, column }" slot="action">
                  <Button
                    type="info"
                    size="small"
                    style="margin-right: 5px"
                    v-if="column.detailType.open"
                    @click="showDetail(row)"
                  >
                    详情
                  </Button>

                  <Button
                    type="primary"
                    size="small"
                    style="margin-right: 5px"
                    v-if="column.updateType.open"
                    @click="showUpdate(row)"
                  >
                    修改
                  </Button>

                  <Button
                    type="error"
                    size="small"
                    v-if="column.delType.open"
                    @click="deptDelTableData({ row, delType: column.delType })"
                  >
                    <span>删除</span>
                  </Button>
                </template>
              </Table>

              <div class="dt-page right">
                <Page
                  :page-size="10"
                  :show-total="true"
                  :show-elevator="true"
                  :show-sizer="true"
                  :page-size-opts="[10, 20, 30]"
                  :currentPage="1"
                  :current.sync="deptPageConfig.current"
                  :total="deptPageConfig.total"
                  @on-change="deptPageChange"
                  @on-page-size-change="deptPageSizeChange"
                  style=" padding:15px;"
                ></Page>
              </div>
            </div>
          </Card>
        </div>
      </Col>
      <Col :span="12">
        <div class="comCard">
          <Card dis-hover>
            <div
              class="comLabel"
              style=" padding:15px; border-bottom-width:1px; border-bottom-style:solid; border-bottom-color:#E6E6E6; font-size:16px; font-weight:bold;"
            >
              <p>
                &nbsp;人员列表
              </p>

              <div class="btnGroup">
                <div>
                  <Button
                    icon="md-refresh"
                    @click="
                      searchPersonSearch({
                        formId: '',
                        ajaxUrl:
                          'http://design.xundacloud.com/autoCoding/project/addPageData',
                        tableId: 'a6103c6e085e7',
                        reformId: '',
                        pageRecordId: '',
                      })
                    "
                  >
                    刷新
                  </Button>
                </div>
              </div>
            </div>
            <div class="comQuery " style=" padding:15px;">
              <Form inline>
                <Form-item>
                  <Select
                    v-model="searchUserSearchKey"
                    not-found-text="暂无数据"
                    :disabled="searchMore"
                    transfer
                    transfer-class-name="customTransfer"
                    class=""
                    style=" width:140px;"
                  >
                    <Option
                      v-for="(item, index) in searchUserQuery"
                      :value="item.value"
                      :key="index"
                      @click.native="searchUserQuerySelect(item)"
                    >
                      {{ item.label }}
                    </Option>
                  </Select>
                </Form-item>
                <Form-item>
                  <div v-for="(colum, cindex) in searchUserQuery" :key="cindex">
                    <div
                      v-if="
                        searchUserType === colum.type &&
                          searchUserType === 'text'
                      "
                    >
                      <Input
                        v-bind="colum.props"
                        v-model="colum.mValue"
                        v-if="colum.value === searchUserSearchKey"
                        :disabled="searchUserSearchMore"
                        class=""
                        style=" width:200px;"
                      ></Input>
                    </div>
                    <div
                      v-if="
                        searchUserType === colum.type &&
                          searchUserType === 'select'
                      "
                    >
                      <Select
                        v-if="colum.value === searchUserSearchKey"
                        v-bind="colum.props"
                        :disabled="searchUserSearchMore"
                        transfer
                        class="customSelect "
                        v-model="colum.mValue"
                        style=" width:200px;"
                      >
                        <Option
                          v-for="(item, iIndex) in colum.optionList"
                          :key="iIndex"
                          :value="item.value"
                        >
                          {{ item.label }}
                        </Option>
                      </Select>
                    </div>
                    <div
                      v-if="
                        searchUserType === colum.type &&
                          searchUserType === 'date'
                      "
                    >
                      <DatePicker
                        v-bind="colum.props"
                        v-if="colum.value === searchUserSearchKey"
                        :disabled="searchUserSearchMore"
                        class=""
                        v-model="colum.mValue"
                        transfer
                        style=" width:200px;"
                      ></DatePicker>
                    </div>
                  </div>
                </Form-item>
                <Form-item>
                  <Button
                    name="查询"
                    icon="md-search"
                    type="primary"
                    @click="searchUserQuerySearch()"
                  >
                    查询
                  </Button>
                  <Button name="组合查询" @click="searchUsersearchMore()">
                    组合查询&nbsp;
                    <Icon
                      type="ios-arrow-down"
                      v-show="!searchUserSearchMore"
                    />
                    <Icon type="ios-arrow-up" v-show="searchUserSearchMore" />
                  </Button>
                </Form-item>
                <div class="searchMoreBox" v-if="searchUserSearchMore">
                  <Form-item
                    v-for="(item, index) in searchUserQuery"
                    :key="index"
                  >
                    <div v-if="item.type === 'text'">
                      <div class="inline">
                        <span class="label ">{{ item.label }}</span>
                        <Input
                          v-bind="item.props"
                          class=""
                          v-model="item.mValue"
                        ></Input>
                      </div>
                    </div>
                    <div v-if="item.type === 'select'">
                      <div class="inline">
                        <span class="label ">{{ item.label }}</span>
                        <Select
                          v-bind="item.props"
                          transfer
                          class="customSelect  "
                          v-model="item.mValue"
                        >
                          <Option
                            v-for="(citem, iIndex) in item.optionList"
                            :key="iIndex"
                            :value="citem.value"
                          >
                            {{ citem.label }}
                          </Option>
                        </Select>
                      </div>
                    </div>
                    <div v-if="item.type === 'date'">
                      <div class="inline">
                        <span class="label ">{{ item.label }}</span>
                        <DatePicker v-model="item.mValue" class=""></DatePicker>
                      </div>
                    </div>
                  </Form-item>
                </div>
              </Form>
            </div>
            <div class="comTabel" style=" margin-left:15px; margin-right:15px;">
              <Table
                :columns="personTable"
                :data="personTableData"
                :height="300"
                :show-header="true"
                :border="true"
                :highlight-row="true"
                @on-row-click="personRowClick"
              >
                <template slot-scope="{ row, column }" slot="auto">
                  <component
                    :is="column.type"
                    :data="row[column.key]"
                  ></component>
                </template>
                <template slot-scope="{ row, column }" slot="action">
                  <Button
                    type="info"
                    size="small"
                    style="margin-right: 5px"
                    v-if="column.detailType.open"
                    @click="showDetail(row)"
                  >
                    详情
                  </Button>

                  <Button
                    type="primary"
                    size="small"
                    style="margin-right: 5px"
                    v-if="column.updateType.open"
                    @click="showUpdate(row)"
                  >
                    修改
                  </Button>

                  <Button
                    type="error"
                    size="small"
                    v-if="column.delType.open"
                    @click="
                      personDelTableData({ row, delType: column.delType })
                    "
                  >
                    <span>删除</span>
                  </Button>
                </template>
              </Table>

              <div class="dt-page right">
                <Page
                  :page-size="10"
                  :show-elevator="true"
                  :show-sizer="true"
                  :page-size-opts="[10, 20, 30]"
                  :currentPage="1"
                  :current.sync="personPageConfig.current"
                  :total="personPageConfig.total"
                  @on-change="personPageChange"
                  @on-page-size-change="personPageSizeChange"
                  style=" padding:15px;"
                ></Page>
              </div>
            </div>
          </Card>
        </div>
      </Col>
    </Row>
    <div class="comCard">
      <Card dis-hover style=" margin-top:20px;">
        <div
          class="comLabel"
          style=" padding:15px; border-bottom-width:1px; border-bottom-style:solid; border-bottom-color:#E6E6E6; font-size:16px; font-weight:bold;"
        >
          <p>
            &nbsp;项目经验列表
          </p>

          <div class="btnGroup">
            <div>
              <Button
                icon="md-refresh"
                @click="
                  searchProjectSearch({
                    formId: '',
                    ajaxUrl:
                      'http://design.xundacloud.com/autoCoding/project/addPageData',
                    tableId: 'a4e1f5c41f108',
                    reformId: '',
                    pageRecordId: '',
                  })
                "
              >
                刷新
              </Button>
            </div>
          </div>
        </div>
        <div class="comQuery " style=" padding:15px;">
          <Form inline>
            <Form-item>
              <Select
                v-model="proSearchSearchKey"
                not-found-text="暂无数据"
                :disabled="searchMore"
                transfer
                transfer-class-name="customTransfer"
                class=""
                style=" width:160px;"
              >
                <Option
                  v-for="(item, index) in proSearchQuery"
                  :value="item.value"
                  :key="index"
                  @click.native="proSearchQuerySelect(item)"
                >
                  {{ item.label }}
                </Option>
              </Select>
            </Form-item>
            <Form-item>
              <div v-for="(colum, cindex) in proSearchQuery" :key="cindex">
                <div
                  v-if="
                    proSearchType === colum.type && proSearchType === 'text'
                  "
                >
                  <Input
                    v-bind="colum.props"
                    v-model="colum.mValue"
                    v-if="colum.value === proSearchSearchKey"
                    :disabled="proSearchSearchMore"
                    class=""
                    style=" width:280px;"
                  ></Input>
                </div>
                <div
                  v-if="
                    proSearchType === colum.type && proSearchType === 'select'
                  "
                >
                  <Select
                    v-if="colum.value === proSearchSearchKey"
                    v-bind="colum.props"
                    :disabled="proSearchSearchMore"
                    transfer
                    class="customSelect "
                    v-model="colum.mValue"
                    style=" width:280px;"
                  >
                    <Option
                      v-for="(item, iIndex) in colum.optionList"
                      :key="iIndex"
                      :value="item.value"
                    >
                      {{ item.label }}
                    </Option>
                  </Select>
                </div>
                <div
                  v-if="
                    proSearchType === colum.type && proSearchType === 'date'
                  "
                >
                  <DatePicker
                    v-bind="colum.props"
                    v-if="colum.value === proSearchSearchKey"
                    :disabled="proSearchSearchMore"
                    class=""
                    v-model="colum.mValue"
                    transfer
                    style=" width:280px;"
                  ></DatePicker>
                </div>
              </div>
            </Form-item>
            <Form-item>
              <Button
                name="查询"
                icon="md-search"
                type="primary"
                @click="proSearchQuerySearch()"
              >
                查询
              </Button>
              <Button name="组合查询" @click="proSearchsearchMore()">
                组合查询&nbsp;
                <Icon type="ios-arrow-down" v-show="!proSearchSearchMore" />
                <Icon type="ios-arrow-up" v-show="proSearchSearchMore" />
              </Button>
            </Form-item>
            <div class="searchMoreBox" v-if="proSearchSearchMore">
              <Form-item v-for="(item, index) in proSearchQuery" :key="index">
                <div v-if="item.type === 'text'">
                  <div class="inline">
                    <span class="label ">{{ item.label }}</span>
                    <Input
                      v-bind="item.props"
                      class=""
                      v-model="item.mValue"
                    ></Input>
                  </div>
                </div>
                <div v-if="item.type === 'select'">
                  <div class="inline">
                    <span class="label ">{{ item.label }}</span>
                    <Select
                      v-bind="item.props"
                      transfer
                      class="customSelect  "
                      v-model="item.mValue"
                    >
                      <Option
                        v-for="(citem, iIndex) in item.optionList"
                        :key="iIndex"
                        :value="citem.value"
                      >
                        {{ citem.label }}
                      </Option>
                    </Select>
                  </div>
                </div>
                <div v-if="item.type === 'date'">
                  <div class="inline">
                    <span class="label ">{{ item.label }}</span>
                    <DatePicker v-model="item.mValue" class=""></DatePicker>
                  </div>
                </div>
              </Form-item>
            </div>
          </Form>
        </div>
        <div class="comTabel" style=" margin-left:15px; margin-right:15px;">
          <Table
            :columns="projectListTable"
            :data="projectListTableData"
            :show-header="true"
            :border="true"
          >
            <template slot-scope="{ row, column }" slot="auto">
              <component :is="column.type" :data="row[column.key]"></component>
            </template>
            <template slot-scope="{ row, column }" slot="action">
              <Button
                type="info"
                size="small"
                style="margin-right: 5px"
                v-if="column.detailType.open"
                @click="showDetail(row)"
              >
                详情
              </Button>

              <Button
                type="primary"
                size="small"
                style="margin-right: 5px"
                v-if="column.updateType.open"
                @click="showUpdate(row)"
              >
                修改
              </Button>

              <Button
                type="error"
                size="small"
                v-if="column.delType.open"
                @click="
                  projectListDelTableData({ row, delType: column.delType })
                "
              >
                <span>删除</span>
              </Button>
            </template>
          </Table>

          <div class="dt-page right">
            <Page
              :page-size="10"
              :show-total="true"
              :show-elevator="true"
              :show-sizer="true"
              :page-size-opts="[10, 20, 30]"
              :currentPage="1"
              :current.sync="projectListPageConfig.current"
              :total="projectListPageConfig.total"
              @on-change="projectListPageChange"
              @on-page-size-change="projectListPageSizeChange"
              style=" padding:15px;"
            ></Page>
          </div>
        </div>
      </Card>
    </div>
  </div>
</template>
<script>
import selfComponents from "@/components/comm/dtTable/components";
import echarts from "echarts";
import { areaValue, areaData } from "@/libs/common";
import { chartOn, chartOff } from "@/libs/tools";
import area from "@/components/comm/area";

export default {
  components: {
    ...selfComponents,
  },
  data() {
    return {
      searchQuery: [
        {
          value: "departmentName",
          type: "text",
          label: "部门名称",
          operate: "lk",
          props: { placeholder: "请输入部门名称", clearable: true },
          productionUrl: "",
          optionList: [
            { label: "选项一", value: "key1" },
            { label: "选项二", value: "key2" },
          ],
          mValue: "",
        },
        {
          value: "departmentCode",
          label: "部门编码",
          type: "text",
          operate: "lk",
          optionList: [],
          productionUrl: "",
          props: { placeholder: "请输入部门编码", clearable: true },
          mValue: "",
        },
      ],
      searchSearchKey: "departmentName",
      searchType: "text",
      searchSearchMore: false,
      searchMore: false,
      deptTableData: [],
      deptTable: [
        { type: "selection", width: 60, align: "center" },
        {
          title: "部门编码",
          key: "departmentCode",
          type: "dtText",
          slot: "auto",
          align: "left",
          custom: false,
        },
        {
          title: "部门名称",
          key: "departmentName",
          type: "dtText",
          slot: "auto",
          align: "left",
          custom: false,
        },
        {
          title: "部门简介",
          key: "synopsis",
          type: "dtText",
          slot: "auto",
          align: "left",
          custom: false,
        },
      ],
      tableList: [
        {
          tableId: "deptTable",
          parentUuid: "",
          pageRecordId: "",
          "page-size": 10,
        },
        {
          tableId: "personTable",
          parentUuid: "",
          pageRecordId: "",
          "page-size": 10,
        },
        {
          tableId: "projectListTable",
          parentUuid: "",
          pageRecordId: "",
          "page-size": 10,
        },
      ],
      deptPageConfig: { "page-size": 10, current: 1, total: 0 },
      searchUserQuery: [
        {
          value: "fullName",
          type: "text",
          label: "用户姓名",
          operate: "lk",
          props: { placeholder: "请输入用户姓名", clearable: true },
          productionUrl: "",
          optionList: [
            { label: "选项一", value: "key1" },
            { label: "选项二", value: "key2" },
          ],
          mValue: "",
        },
        {
          value: "nickname",
          label: "用户昵称",
          type: "text",
          operate: "lk",
          optionList: [],
          productionUrl: "",
          props: { placeholder: "请输入用户昵称", clearable: true },
          mValue: "",
        },
      ],
      searchUserSearchKey: "fullName",
      searchUserType: "text",
      searchUserSearchMore: false,
      personTableData: [],
      personTable: [
        { type: "selection", width: 60, align: "center" },
        {
          title: "用户姓名",
          key: "fullName",
          type: "dtText",
          slot: "auto",
          align: "left",
          custom: true,
        },
        {
          title: "手机号",
          key: "mobilePhone",
          type: "dtText",
          slot: "auto",
          align: "left",
          custom: true,
        },
        {
          title: "在职",
          key: "jobStr",
          type: "dtText",
          slot: "auto",
          align: "left",
          custom: true,
        },
      ],
      personPageConfig: { "page-size": 10, current: 1, total: 0 },
      proSearchQuery: [
        {
          value: "projectName",
          type: "text",
          label: "项目名称",
          operate: "lk",
          props: { placeholder: "请输入项目名称" },
          productionUrl: "",
          optionList: [
            { label: "选项一", value: "key1" },
            { label: "选项二", value: "key2" },
          ],
          mValue: "",
        },
      ],
      proSearchSearchKey: "projectName",
      proSearchType: "text",
      proSearchSearchMore: false,
      projectListTableData: [],
      projectListTable: [
        { type: "selection", width: 60, align: "center" },
        {
          title: "项目名称",
          key: "projectName",
          type: "dtText",
          slot: "auto",
          align: "left",
        },
        {
          title: "简介",
          key: "introduce",
          type: "dtText",
          slot: "auto",
          align: "left",
        },
      ],
      projectListPageConfig: { "page-size": 10, current: 1, total: 0 },
      pageRecordId: "451",
      personAcceptParams: [
        {
          acceptNewKey: "departmentRecordId",
          acceptParmaKey: "recordId",
          value: "",
          operate: "eq",
        },
      ],
      projectListAcceptParams: [
        {
          acceptNewKey: "personnelRecordId",
          acceptParmaKey: "recordId",
          value: "",
          operate: "eq",
        },
      ],
      adminAddress: "http://test.xundacloud.com:8081/xundacloudDemeAdmin",
      area,
    };
  },
  mounted() {
    this.getdept();
    this.getperson();
    this.getprojectList();
  },
  methods: {
    refreshSearch() {
      this.getdept({
        pSize: this.deptPageConfig["page-size"],
        pNum: 1,
      });
    },

    searchQuerySelect(item) {
      this.searchType = item.type;
      this.searchQuery.forEach(colum => {
        colum.mValue = "";
        return colum;
      });
    },

    searchQuerySearch() {
      const paramList = [];
      this.searchQuery &&
        this.searchQuery.forEach(query => {
          if (query.mValue) {
            paramList.push({
              key: query.value,
              value: query.mValue,
              operate: query.operate,
            });
          }
        });

      this.deptAcceptParams &&
        this.deptAcceptParams.forEach(acceptParam => {
          if (acceptParam.value) {
            paramList.push({
              key: acceptParam.acceptNewKey,
              value: acceptParam.value,
              operate: acceptParam.operate,
            });
          }
        });

      this.getdept({
        pSize: this.deptPageConfig["page-size"],
        pNum: 1,
        paramList,
      });
    },

    searchsearchMore() {
      this.searchSearchMore = !this.searchSearchMore;
    },

    getdept(params = "") {
      if (!params) {
        params = {
          pSize: this.deptPageConfig["page-size"],
          pNum: this.deptPageConfig.current,
        };
      }
      this.axios
        .post("/sys/sysDepartment/findList", {
          data: JSON.stringify({ ...params }),
        })
        .then(resp => {
          const { code, data } = resp.data;
          if (code === "E0") {
            this.deptTableData = data.list;
            this.deptPageConfig.total = data.total;
          } else {
            this.deptTableData = [];
          }
        });
    },
    deptPageChange(value) {
      this.getdept();
    },
    deptPageSizeChange(value) {
      this.deptPageConfig.current = 1;
      this.deptPageConfig["page-size"] = value;
      this.getdept();
    },

    deptDelTableData({ row, delType, pageRecordId, parentUuid, tableId }) {
      if (!delType) return;
      if (delType && delType.confirm) {
        this.$Modal.confirm({
          title: "删除提示",
          content: "确定删除此数据吗？",
          onOk: () => {
            this.deptDelItem({
              recordId: row.recordId,
              pageRecordId,
              parentUuid,
              tableId,
              delType,
            });
          },
        });
      } else {
        this.deptDelItem({
          recordId: row.recordId,
          pageRecordId,
          parentUuid,
          tableId,
          delType,
        });
      }
    },
    async deptDelItem({
      recordId,
      pageRecordId,
      parentUuid,
      tableId,
      delType,
    }) {
      const resp = await this.axios.post(
        delType.productionUrl ? delType.productionUrl : delType.url,
        {
          data: JSON.stringify([recordId]),
        },
      );
      const { code, message } = resp.data;
      if (code === "E0") {
        this.$Message.success("删除数据成功");
        this.getdept();
      } else {
        this.$Message.error(message);
      }
    },

    async getdeptChild(row) {},

    deptRowClick(row) {
      this.personAcceptParams.forEach(acceptParams => {
        const { acceptParmaKey } = acceptParams;
        acceptParams.value = row[acceptParmaKey];
      });

      this.searchUserQuerySearch();
    },

    searchPersonSearch() {
      this.getperson({
        pSize: this.personPageConfig["page-size"],
        pNum: 1,
      });
    },

    searchUserQuerySelect(item) {
      this.searchUserType = item.type;
      this.searchUserQuery.forEach(colum => {
        colum.mValue = "";
        return colum;
      });
    },

    searchUserQuerySearch() {
      const paramList = [];
      this.searchUserQuery &&
        this.searchUserQuery.forEach(query => {
          if (query.mValue) {
            paramList.push({
              key: query.value,
              value: query.mValue,
              operate: query.operate,
            });
          }
        });

      this.personAcceptParams &&
        this.personAcceptParams.forEach(acceptParam => {
          if (acceptParam.value) {
            paramList.push({
              key: acceptParam.acceptNewKey,
              value: acceptParam.value,
              operate: acceptParam.operate,
            });
          }
        });

      this.getperson({
        pSize: this.personPageConfig["page-size"],
        pNum: 1,
        paramList,
      });
    },

    searchUsersearchMore() {
      this.searchUserSearchMore = !this.searchUserSearchMore;
    },

    getperson(params = "") {
      if (!params) {
        params = {
          pSize: this.personPageConfig["page-size"],
          pNum: this.personPageConfig.current,
        };
      }
      this.axios
        .post("/sys/sysPersonnel/findList", {
          data: JSON.stringify({ ...params }),
        })
        .then(resp => {
          const { code, data } = resp.data;
          if (code === "E0") {
            this.personTableData = data.list;
            this.personPageConfig.total = data.total;
          } else {
            this.personTableData = [];
          }
        });
    },
    personPageChange(value) {
      this.getperson();
    },
    personPageSizeChange(value) {
      this.personPageConfig.current = 1;
      this.personPageConfig["page-size"] = value;
      this.getperson();
    },

    personDelTableData({ row, delType, pageRecordId, parentUuid, tableId }) {
      if (!delType) return;
      if (delType && delType.confirm) {
        this.$Modal.confirm({
          title: "删除提示",
          content: "确定删除此数据吗？",
          onOk: () => {
            this.personDelItem({
              recordId: row.recordId,
              pageRecordId,
              parentUuid,
              tableId,
              delType,
            });
          },
        });
      } else {
        this.personDelItem({
          recordId: row.recordId,
          pageRecordId,
          parentUuid,
          tableId,
          delType,
        });
      }
    },
    async personDelItem({
      recordId,
      pageRecordId,
      parentUuid,
      tableId,
      delType,
    }) {
      const resp = await this.axios.post(
        delType.productionUrl ? delType.productionUrl : delType.url,
        {
          data: JSON.stringify([recordId]),
        },
      );
      const { code, message } = resp.data;
      if (code === "E0") {
        this.$Message.success("删除数据成功");
        this.getperson();
      } else {
        this.$Message.error(message);
      }
    },

    async getpersonChild(row) {},

    personRowClick(row) {
      this.projectListAcceptParams.forEach(acceptParams => {
        const { acceptParmaKey } = acceptParams;
        acceptParams.value = row[acceptParmaKey];
      });

      this.proSearchQuerySearch();
    },

    searchProjectSearch() {
      this.getprojectList({
        pSize: this.projectListPageConfig["page-size"],
        pNum: 1,
      });
    },

    proSearchQuerySelect(item) {
      this.proSearchType = item.type;
      this.proSearchQuery.forEach(colum => {
        colum.mValue = "";
        return colum;
      });
    },

    proSearchQuerySearch() {
      const paramList = [];
      this.proSearchQuery &&
        this.proSearchQuery.forEach(query => {
          if (query.mValue) {
            paramList.push({
              key: query.value,
              value: query.mValue,
              operate: query.operate,
            });
          }
        });

      this.projectListAcceptParams &&
        this.projectListAcceptParams.forEach(acceptParam => {
          if (acceptParam.value) {
            paramList.push({
              key: acceptParam.acceptNewKey,
              value: acceptParam.value,
              operate: acceptParam.operate,
            });
          }
        });

      this.getprojectList({
        pSize: this.projectListPageConfig["page-size"],
        pNum: 1,
        paramList,
      });
    },

    proSearchsearchMore() {
      this.proSearchSearchMore = !this.proSearchSearchMore;
    },

    getprojectList(params = "") {
      if (!params) {
        params = {
          pSize: this.projectListPageConfig["page-size"],
          pNum: this.projectListPageConfig.current,
        };
      }
      this.axios
        .post("/sys/sysPorjectExperience/findList", {
          data: JSON.stringify({ ...params }),
        })
        .then(resp => {
          const { code, data } = resp.data;
          if (code === "E0") {
            this.projectListTableData = data.list;
            this.projectListPageConfig.total = data.total;
          } else {
            this.projectListTableData = [];
          }
        });
    },
    projectListPageChange(value) {
      this.getprojectList();
    },
    projectListPageSizeChange(value) {
      this.projectListPageConfig.current = 1;
      this.projectListPageConfig["page-size"] = value;
      this.getprojectList();
    },

    projectListDelTableData({
      row,
      delType,
      pageRecordId,
      parentUuid,
      tableId,
    }) {
      if (!delType) return;
      if (delType && delType.confirm) {
        this.$Modal.confirm({
          title: "删除提示",
          content: "确定删除此数据吗？",
          onOk: () => {
            this.projectListDelItem({
              recordId: row.recordId,
              pageRecordId,
              parentUuid,
              tableId,
              delType,
            });
          },
        });
      } else {
        this.projectListDelItem({
          recordId: row.recordId,
          pageRecordId,
          parentUuid,
          tableId,
          delType,
        });
      }
    },
    async projectListDelItem({
      recordId,
      pageRecordId,
      parentUuid,
      tableId,
      delType,
    }) {
      const resp = await this.axios.post(
        delType.productionUrl ? delType.productionUrl : delType.url,
        {
          data: JSON.stringify([recordId]),
        },
      );
      const { code, message } = resp.data;
      if (code === "E0") {
        this.$Message.success("删除数据成功");
        this.getprojectList();
      } else {
        this.$Message.error(message);
      }
    },

    async getprojectListChild(row) {},

    gotoPage(functionPath) {
      this.$router.push({ path: functionPath });
    },
  },
};
</script>
